<script setup lang="ts">
import { onMounted, ref } from 'vue'
import Top from '@/views/screen/components/Top.vue'
import Tourist from '@/views/screen/components/Tourist.vue'
import Age from '@/views/screen/components/Age.vue'
import Sex from '@/views/screen/components/Sex.vue'
import Map from '@/views/screen/components/map/Map.vue'
import Line from '@/views/screen/components/Line.vue'
import Rank from '@/views/screen/components/Rank.vue'
import Year from '@/views/screen/components/Year.vue'
import Order from '@/views/screen/components/Order.vue'
let screen = ref()
onMounted(() => {
  screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`
})
function getScale(w = 1920, h = 1080) {
  const ww = window.innerWidth / w
  const wh = window.innerHeight / h
  return ww < wh ? ww : wh
}
window.onresize = () => {
  screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`
}
</script>

<template>
  <div class="screenBox">
    <div class="screen" ref="screen">
      <div class="top">
        <Top />
      </div>
      <div class="content">
        <div class="left">
          <div class="tourist"><Tourist></Tourist></div>
          <div class="sex"><Sex></Sex></div>
          <div class="age"><Age></Age></div>
        </div>
        <div class="middle">
          <div class="map"><Map></Map></div>
          <div class="m_line"><Line></Line></div>
        </div>
        <div class="right">
          <div class="rank"><Rank></Rank></div>
          <div class="year"><Year></Year></div>
          <div class="order"><Order></Order></div>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.screenBox {
  width: 100vw;
  height: 100vh;
  background: url('./images/bg.png') no-repeat;
  background-size: cover;
  .screen {
    width: 1920px;
    height: 1080px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform-origin: left top;
    .top {
      width: 100%;
      height: 40px;
    }
    .content {
      display: flex;
      height: 1040px;
      padding: 0 20px;
      .left {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        .tourist {
          flex: 1;
        }
        .sex {
          flex: 1;
        }
        .age {
          flex: 1;
        }
      }
      .middle {
        flex: 2;
        display: flex;
        flex-direction: column;
        margin-top: 85px;
        padding: 0 30px;
        justify-content: space-between;
        .map {
          width: 100%;
          flex: 3;
        }
        .m_line {
          flex: 1.5;
        }
      }
      .right {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        .rank {
          flex: 1;
        }
        .year {
          flex: 1;
        }
        .order {
          flex: 1;
        }
      }
    }
  }
}
</style>
